﻿using ParkSaleSDK.Adapter;
using ParkSaleSDK.MainSystem;
using ParkSalesRootAdapter;
using ReadOnlyParkSaleAdapter;
namespace SystemSetting
{
    public class SystemAdapters
    {
        public static DatabaseSetting Database
        {
            get;
            set;
        }
        public static void Init()
        {
            r_AD = new readOnly_ADAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            r_Company = new readOnly_CompanyAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            r_location = new readOnly_LocationAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            r_Order = new readOnly_OrderAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            r_OwnedHouse = new readOnly_OwnedHouseAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            r_Rights = new readOnly_ParkRightAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            r_Park = new readOnly_ParkTableAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            r_Discount = new readOnly_UserDiscountAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            r_User = new safe_UserTableAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            wr_User = new UserTableAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
            w_AD = (ADAdapter)new ADAdapter().Init(Database.Server, Database.Database, c_Advertisement.Table, Database.UserName, Database.Password, Database.Port);
            w_Company = (CompanyAdapter)new CompanyAdapter().Init(Database.Server, Database.Database, c_Company.Table, Database.UserName, Database.Password, Database.Port);
            w_Location = (LocationAdapter)new LocationAdapter().Init(Database.Server, Database.Database, c_Location.Table, Database.UserName, Database.Password, Database.Port);
            w_Order = (OrderAdapter)new OrderAdapter().Init(Database.Server, Database.Database, c_Order.Table, Database.UserName, Database.Password, Database.Port);
            w_OwnedHouse = (OwnedHouseAdapter)new OwnedHouseAdapter().Init(Database.Server, Database.Database, c_OwnedHouse.Table, Database.UserName, Database.Password, Database.Port);
            w_Rights = (ParkRightTableAdapter)new ParkRightTableAdapter().Init(Database.Server, Database.Database, c_Rights.Table, Database.UserName, Database.Password, Database.Port);
            w_Park = (ParkTableAdapter)new ParkTableAdapter().Init(Database.Server, Database.Database, c_Parking.Table, Database.UserName, Database.Password, Database.Port);
            w_Discount = (UserDicountAdapter)new UserDicountAdapter().Init(Database.Server, Database.Database, c_Discount.Table, Database.UserName, Database.Password, Database.Port);
            w_Message = (MessageAdapter)new MessageAdapter().Init(Database.Server, Database.Database, c_Message.Table, Database.UserName, Database.Password, Database.Port);
            r_Message = new readOnly_MessageAdapter(Database.Server, Database.Database, Database.UserName, Database.Password, Database.Port);
        }


        public static readOnly_ADAdapter r_AD;
        public static readOnly_CompanyAdapter r_Company;
        public static readOnly_LocationAdapter r_location;
        public static readOnly_OrderAdapter r_Order;
        public static readOnly_OwnedHouseAdapter r_OwnedHouse;
        public static readOnly_ParkRightAdapter r_Rights;
        public static readOnly_ParkTableAdapter r_Park;
        public static readOnly_UserDiscountAdapter r_Discount;
        public static safe_UserTableAdapter r_User;
        public static UserTableAdapter wr_User;
        public static ADAdapter w_AD;
        public static CompanyAdapter w_Company;
        public static LocationAdapter w_Location;
        public static OrderAdapter w_Order;
        public static OwnedHouseAdapter w_OwnedHouse;
        public static ParkRightTableAdapter w_Rights;
        public static ParkTableAdapter w_Park;
        public static UserDicountAdapter w_Discount;
        public static MessageAdapter w_Message;
        public static readOnly_MessageAdapter r_Message;
    }

    public class Manangers
    {
        static APIServer.ModuleSystem.SurveyModuleManager manager = new APIServer.ModuleSystem.SurveyModuleManager();
        static APIServer.ModuleSystem.DicountModuleManager dicountModule = new APIServer.ModuleSystem.DicountModuleManager();
        static APIServer.ModuleSystem.MessageModuleManager messageModule = new APIServer.ModuleSystem.MessageModuleManager();
        

        public static APIServer.ModuleSystem.MessageModuleManager Message
        {
            get => messageModule;
        }
        public static APIServer.ModuleSystem.SurveyModuleManager Survey
        {
            get => manager;
        }
        public static APIServer.ModuleSystem.DicountModuleManager Dicount
        {
            get => dicountModule;
        }

    }


}
